]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspacesView: Add API to hide workspaces without destroying
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Fri, 5 Jun 2020 05:23:53 +0000 (02:23 -0300)
committerMarge Bot <marge-bot@gnome.org>
Fri, 29 Jan 2021 15:01:03 +0000 (15:01 +0000)
This will be used by the next commit to hide workspaces when ViewSelector
switches to the search page, without destroying the workspaces so their
state is preserved.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1593>

js/ui/workspacesView.js

index 99a1e65973d8cc55a7b2010e2550cb523efa6563..9e1dccb0f711cc133ec99ecb364cccd6fcbd15f2 100644 (file)
@@ -404,6 +404,7 @@ class WorkspacesDisplay extends St.Widget {
             this._syncWorkspacesActualGeometry();
         });
 
+        this._primaryVisible = true;
         this._primaryIndex = Main.layoutManager.primaryIndex;
         this._workspacesViews = [];
 
@@ -570,6 +571,18 @@ class WorkspacesDisplay extends St.Widget {
         return this._getPrimaryView().navigate_focus(from, direction, false);
     }
 
+    setPrimaryWorkspaceVisible(visible) {
+        if (this._primaryVisible === visible)
+            return;
+
+        this._primaryVisible = visible;
+
+        const primaryIndex = Main.layoutManager.primaryIndex;
+        const primaryWorkspace = this._workspacesViews[primaryIndex];
+        if (primaryWorkspace)
+            primaryWorkspace.visible = visible;
+    }
+
     animateToOverview(fadeOnPrimary) {
         this.show();
         this._updateWorkspacesViews();
@@ -672,6 +685,8 @@ class WorkspacesDisplay extends St.Widget {
             this._workspacesViews.push(view);
             Main.layoutManager.overviewGroup.add_actor(view);
         }
+
+        this._workspacesViews[this._primaryIndex].visible = this._primaryVisible;
     }
 
     _getMonitorIndexForEvent(event) {